1. Problem
You need to control the order
in which the BizTalk rules engine executes rules. The order BizTalk
executes rules in determines which rules take precedence, with the
results of the last rule executing and potentially overwriting the
results of the previous rules.
2. Solution
In many real-world
scenarios, multiple business rules must execute in a predetermined
order. In these situations, the second rule may overwrite the result of
the first rule. Control the order in which the BizTalk rules engine
executes rules by assigning a priority to each rule.
NOTE
This example assumes that
the business rules already exist.
The following steps demonstrate how to set the priority of a business rule:
Open the Business Rules Composer.
Navigate to the policy containing the rules.
Select the Use Preferred Shipper rule in the Policy Explorer, and change the Priority property to the value 1, as shown in Figure 1.
NOTE
The BizTalk rules
engine executes higher-priority rules first. Since the promotional
shipping rate rule should override the preferred shipper rule, it must
execute after the preferred shipper rule and must have a lower priority.
3. How It Works
The BizTalk rules engine
executes high-priority rules first. Consequently, lower-priority rules
execute after higher-priority ones and potentially can override the
results of higher-priority rules. The BizTalk rules engine may execute
rules with the same priority in any order. Remember that the priority of
rules will affect the order BizTalk executes them in and has no direct
effect on the importance of the rule's actions.